package com.weilai.common.service;

import com.weilai.common.dao.RedeemCodeMapper;
import com.weilai.common.model.RedeemCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Song on 2017/6/4.
 */
@Service
public class RedeemCodeService {
    @Autowired
    RedeemCodeMapper redeemCodeMapper;
    public Integer addCode(RedeemCode code) {
        return redeemCodeMapper.insert(code);
    }

    public int del8Code(RedeemCode redeemCode) {
        return redeemCodeMapper.deleteByPrimaryKey(redeemCode);
    }


    public int deleteByCode(RedeemCode redeemCode) {
        return redeemCodeMapper.deleteByCode(redeemCode);
    }


    public int update8Code(RedeemCode redeemCode) {
        return redeemCodeMapper.updateByPrimaryKey(redeemCode);
    }

    public List<RedeemCode> findAllCode(RedeemCode redeemCode) {
       return  redeemCodeMapper.findAllCode(redeemCode);
    }

    public RedeemCode findByCode(RedeemCode code) {
        return redeemCodeMapper.findByCode(code);
    }
}
